from typing import List

from pydantic import Field

from common.base_models import InfectionMonkeyBaseModel
from common.types import NetworkPort


class HadoopOptions(InfectionMonkeyBaseModel):
    target_ports: List[NetworkPort] = Field(
        default=[8088],
        description="A list of HTTP ports that the Hadoop exploiter will try to exploit.",
    )
    try_all_discovered_http_ports: bool = Field(
        default=False,
        description="Attempt to exploit Hadoop on all HTTP ports discovered from network scanning.",
    )
    request_timeout: float = Field(
        gt=0.0,
        default=15.0,
        description="The maximum time (in seconds) to wait for a response from a Hadoop server.",
    )
    agent_binary_download_timeout: float = Field(
        gt=0.0,
        default=60.0,
        description="The maximum time (in seconds) to wait for a successfully exploited"
        " Hadoop server to download the agent binary.",
    )
    yarn_application_suffix: str = Field(
        default="M0NK3Y3XPL01T",
        description="A string that will be appended to a unique YARN application name.",
    )
